<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>
<form name="form1" id="form1" action="${systemctx}/sample/saveSample.web" method="post">

	<div class="pageMain">
		<div class="pageTitle">
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.bascsetting.title")%>
			<span></span>
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.parameter.title1") %>
			<span></span>
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.parameter.title2") %>
		</div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i></i>
						<label>
							<%=MessageResourcesUtils.getMessage(request, "systemmanage.parameter.column.name")%>
						</label>
						<span><input type="text" id="name" name="name"/></span> 
					</li>
					<li>
						<i></i>
						<label>
							<%=MessageResourcesUtils.getMessage(request,"systemmanage.parameter.column.type")%>
						</label>
						<span><select name="type" id="type"></select></span> 
					</li>
				</ul>
			</div>	
		</div>
		<div class="button-group">
			<input type="button" class="btn btn-default" id="butQuery" name="butQuery" value="<%=MessageResourcesUtils.getMessage(request, "common.button.query") %>" />
			<input type="button" class="btn btn-default" onclick="toAddParameter()" value="<%=MessageResourcesUtils.getMessage(request,"common.button.add")%>" />
		</div>
		<table>
			<tbody>
				<tr>
					<td>
						<table id="datagrid"></table>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	
</form>
<script type="text/javascript">
	$(document).ready(function(){
		$("#type").selectutil({
			optModel : <%=SysConstant.ParameterType.getModelJSONString(true,false)%>,
			optDefault : ''
		});
		
		$('#datagrid').issdatagrid({
			formid : 'form1',
			title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.parameter.title2")%>',
			width : 'auto',
			nowrap : true,
			autoRowHeight : false,
			singleSelect : true,
			striped : true,
			url : '${systemctx}/systemmanage/parameter/queryParameterListInfoDataGrid.json',
			sortName: 'modifytime',
			sortOrder: 'desc',
			remoteSort : true,
			idField : 'id',
			pagination : true,
			rownumbers : true,
			showFooter : true,
			queryParams:$('#form1').serializeObject(),
			columns : [[ 
				{	field : 'id',
					title : '<%=MessageResourcesUtils.getMessage(request, "common.button.operation") %>',
					width : 60,
					align : 'center',
					formatter : operate
				},
			  	{title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.parameter.column.code")%>',field : 'code',sortable : true,align : 'left',width:250,formatter:function(value,row,index){
					 return "<a href=\"javascript:void(0)\" onclick=\"view('"+row.id+"')\">"+value+"</a>"
				}},
	            {title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.parameter.column.name")%>',field : 'name',sortable : true,align : 'left',width:230},
	            {title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.parameter.column.description")%>',field : 'description',sortable : true,align : 'left',width:300},
	            {title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.parameter.column.value")%>',field : 'value',sortable : true,align : 'left',width:100},
	            {title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.parameter.column.type")%>',field : 'type',sortable : true,width : 120,align : 'left'}
	        ]],
			onLoadSuccess : function(data) {

			}
		});
		$('#butQuery').click(function() {
			$('#datagrid').datagrid('load',$('#form1').serializeObject());
		});
		function operate(val, row) {
			return '<a href="javascript:void(0);" class="easyui-linkbutton" onclick="parameterModify('+val
			+')"><%=MessageResourcesUtils.getMessage(request, "common.button.update") %></a>';
		}
	});

	function toAddParameter(){
		$(this).isswindow({
			noheader : true,
			url :"${systemctx}/systemmanage/parameter/toAddParameter.web"
		});
	}
	function parameterModify(val){
		$(this).isswindow({
			noheader : true,
			url : '${systemctx}/systemmanage/parameter/toUpdateParameter.web?id='+val
		});
	}
	function view(id){
		$(this).isswindow({
			noheader : true,
			url : '${systemctx}/systemmanage/parameter/toViewParameter.web?id='+id
		});
	}
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>